package com.benny_driving.thread;

import android.os.Handler;
import android.os.Looper;

import com.benny_driving.act.PerInfoAct;
import com.benny_driving.http.dao.impl.HttpDaoImpl;

public class UpdatePsdThread extends Thread {
	private String psd = null;
	private String userID;
	private static Handler handler = null;

	public UpdatePsdThread(String psd, String userID) {
		this.psd = psd;
		this.userID = userID;
		handler = new Handler();
	}

	@Override
	public void run() {
		Looper.prepare();
		try {
			boolean f = HttpDaoImpl.getInstance().updatePsd(userID, psd);
			PerInfoAct.handler.sendMessage(handler.obtainMessage(
					PerInfoAct.SUBMIT_DATA, f));
		} catch (Exception e) {
			PerInfoAct.handler.sendMessage(handler.obtainMessage(
					PerInfoAct.NETWORK_ERROR, e.getMessage()));
		} finally {
			Thread.currentThread().interrupt();
		}
	}
}
